package com.tsc.design.responsibilityMode.example1;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: chentl
 * @Date: 2025/09/17/18:56
 * @Description:
 */
public class ChainOfResponsibilityExample {

    public static void main(String[] args) {

        LeaveHandler departmentManager = new DepartmentManager();
        LeaveHandler projectManage = new ProjectManage();
        LeaveHandler generalManager = new GeneralManager();

        projectManage.setNextHandler(departmentManager).setNextHandler(generalManager);

        List<LeaveRequest> leaveRequests = new ArrayList<>();
        leaveRequests.add(new LeaveRequest("张三", 2, "事假"));
        leaveRequests.add(new LeaveRequest("李四", 5, "事假"));
        leaveRequests.add(new LeaveRequest("王五", 10, "事假"));
        for (LeaveRequest leaveRequest : leaveRequests){
            System.out.println(projectManage.handleRequest(leaveRequest));
        }
    }
}
